<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="./ejs.js"></script>
</head>
<body>
    <div id="container"></div>
    <script>
        let arr = [{
            name:"张三",
            age:20
        },{
            name:"李四",
            age:21
        },{
            name:"王五",
            age:23
        }]

        let res = ejs.render(
            `<ul>
           <% arr.forEach(item=>{%>
                <li>名字是：<%=item.name%> ,年龄是<%=item.age%></li>
            <%})%>
            </ul> `
        ,{arr})

        document.querySelector('.container').innerHTML =res;

    </script>
</body>
</html>